package pro.softzhang.algo.lc200;

import pro.softzhang.algo.common.TreeNode;
import pro.softzhang.algo.flag.knowledge.KBinaryTree;

/**
 * 反转二叉树
 */
@KBinaryTree
public class LC226_InvertBinaryTree {
    public static void main(String[] args) {

    }

    /**
     * 前序遍历
     */
    static
    class Solution {
        public TreeNode invertTree(TreeNode root) {
            if (root == null) return null;

            TreeNode right = root.right;
            root.right = invertTree(root.left);
            root.left = invertTree(right);

            return root;
        }
    }
}
